package com.javabean;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.objenesis.instantiator.perc.PercInstantiator;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Data
public class Orders {
  private int id;
    private String orderNum;
    private Date orderTime;
    private int peopleCount;
    private String orderDesc;
    private int payType;// '支付方式（0 支付宝 1微信 2 其他',
    private int orderStatus;// '订单状态（0未支付1已支付）',
    private int productId;// '产品id外键',
    private int memberId;// '会员（联系人）id外键',
    private Product product;
    private Member member;
  private List<Traveller> travellers;
  public String getOrderTimeStr() {
    // 对日期格式化
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    if (null != orderTime) {
      return dateFormat.format(orderTime);
    }
    return null;
  }
  public String getPayTypeStr() {
    String payTypeStr="";
    if (payType == 0){
      payTypeStr = "支付宝";
    } else if(payType == 1){
      payTypeStr = "微信";
    }else if(payType == 2){
      payTypeStr = "其他";
    }
    return payTypeStr;
  }

  public String getOrderStatusStr() {
    String orderStatusStr="";
    if (orderStatus == 0){
      orderStatusStr = "未支付";
    } else if(orderStatus == 1){
      orderStatusStr = "已支付";
    }
    return orderStatusStr;
  }
}
